package org.huamoxi.result;

import lombok.Data;
import org.huamoxi.constant.ResponseStatusConstants;

import java.io.Serializable;

@Data
public class Result<T> implements Serializable {
    Integer code;
    String message;
    T data;

    public Result (int code, String msg) {
        this.code = code;
        this.message = msg;
    }

    public Result (T data) {
        this.code = ResponseStatusConstants.SUCCESS_CODE;
        this.message = ResponseStatusConstants.SUCCESS_MESSAGE;
        this.data = data;
    }

    public Result (String message, T data) {
        this.code = ResponseStatusConstants.SUCCESS_CODE;
        this.message = message;
        this.data = data;
    }

    public Result (int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
